package org.testis.gui.mvc.controller;

import org.testis.gui.mvc.controller.dynamicmap.*;
import org.testis.utils.tree.MyDefaultMutableTreeNode;
import java.awt.Frame;

/**
 *
 * @author Cahit Emir Erel
 */
public class DynamicMapControllerList {

    private DynamicMapTreeController m_dynamicMapTreeController;
    private DynamicMapPopupController m_dynamicMapPopupController;
    private DynamicMapController m_dynamicMapController;
    private LoadDynamicMapController m_loadDynamicMapController;
    private WebPageParserController m_webPageParserController;
    private static DynamicMapControllerList m_reference;
    private Frame m_parentFrame;
    private MyDefaultMutableTreeNode m_jDesignTreeRoot;

    private DynamicMapControllerList() {
    }

    public MyDefaultMutableTreeNode getJDesignTreeRoot() {
        if (m_jDesignTreeRoot == null) {
            setJDesignTreeRoot(new MyDefaultMutableTreeNode(true));
        }
        return m_jDesignTreeRoot;
    }

    public void setJDesignTreeRoot(MyDefaultMutableTreeNode jDesignTreeRoot) {
        m_jDesignTreeRoot = jDesignTreeRoot;
    }

    public static DynamicMapControllerList newInstance() {
        if (m_reference == null) {
            m_reference = new DynamicMapControllerList();
        }
        return m_reference;
    }

    public static DynamicMapControllerList newInstance(DynamicMapTreeController dynamicMapTreeController,
            DynamicMapPopupController dynamicMapPopupController,
            Frame parentFrame) {
        if (m_reference == null) {
            m_reference = new DynamicMapControllerList();
        }
        m_reference.setParentFrame(parentFrame);
        m_reference.setDynamicMapTreeController(dynamicMapTreeController);
        m_reference.setDynamicMapPopupController(dynamicMapPopupController);
        return m_reference;
    }

    public DynamicMapTreeController getDynamicMapTreeController() {
        return m_dynamicMapTreeController;
    }

    public void setDynamicMapTreeController(DynamicMapTreeController dynamicMapTreeController) {
        m_dynamicMapTreeController = dynamicMapTreeController;
    }

    public DynamicMapPopupController getDynamicMapPopupController() {
        return m_dynamicMapPopupController;
    }

    public void setDynamicMapPopupController(DynamicMapPopupController dynamicMapPopupController) {
        m_dynamicMapPopupController = dynamicMapPopupController;
    }

    public Frame getParentFrame() {
        return m_parentFrame;
    }

    public void setParentFrame(Frame parentFrame) {
        m_parentFrame = parentFrame;
    }

    public DynamicMapController getDynamicMapController() {
        if (m_dynamicMapController == null) {
            setDynamicMapController(new DynamicMapController());
        }
        return m_dynamicMapController;
    }

    public void setDynamicMapController(DynamicMapController dynamicMapController) {
        m_dynamicMapController = dynamicMapController;
    }

    public LoadDynamicMapController getLoadDynamicMapController() {
        if (m_loadDynamicMapController == null) {
            setLoadDynamicMapController(new LoadDynamicMapController());
        }
        return m_loadDynamicMapController;
    }

    public void setLoadDynamicMapController(LoadDynamicMapController loadDynamicMapController) {
        m_loadDynamicMapController = loadDynamicMapController;
    }

    public WebPageParserController getWebPageParserController() {
        if (m_webPageParserController == null) {
            setWebPageParserController(new WebPageParserController());
        }
        return m_webPageParserController;
    }

    public void setWebPageParserController(WebPageParserController webPageParserController) {
        m_webPageParserController = webPageParserController;
    }
}
